/*
    www.cguage.com
    2.4 求前N位的质数 用筛法优化
*/

#include <iostream>
#include <sstream>
#include <cassert>
#include <vector>
using namespace std;

#ifndef TEST
#define IN(iss) {                       \
        std::string str;                \
        std::getline(std::cin, str);    \
        iss.str(str);                   \
    }
#define OUT(s) std::cout << s
#endif

#define READ_N(iss, n) {    \
    iss >> n;               \
    iss.ignore(1, ',');     \
}

int main() {
    istringstream iss;
    ostringstream oss;
    IN(iss);
    assert(!iss.eof());
    int n = -1;
    iss >> n;
    assert(n > 1);

    std::vector<int> slot;  // 用来标志&区分的
    std::vector<int> result;
    slot.resize(n + 1 + 6, 1);

    if (n >= 2) {
        oss << 2 << " ";
    }
    if (n >= 3) {
        oss << 3 << " ";
    }
    if (n >= 5) {
        oss << 5 << " ";
    }

    int timesNum = 0;   // 用于避免做乘法(乘2,3,4,5...)
    int step = 2;
    int i = 7;
    for (; i <= n / 2; i += step) {

        if (slot[i]) {
            oss << i  << " ";
        }

        timesNum = i + i;
        while (timesNum < n) {
            slot[timesNum] = 0;
            timesNum += i;
        }

        // 位移只会是2 or 4
        step = 6 - step;
    }

    for (; i <= n; i += step) {
        if (slot[i]) {
            oss << i << " ";
        }
        step = 6 - step;
    }

    string str = oss.str();
    str.erase(str.end() - 1);
    OUT(str);
    return 0;
}

#ifdef TEST
struct TestCase CASES[] = {
    /*0*/{"2", "2"},
    /*1*/{"10", "2 3 5 7"},
    /*2*/{"20", "2 3 5 7 11 13 17 19"},
    /*3*/{"24", "2 3 5 7 11 13 17 19 23"},
};
#endif